<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
        <title>登录</title>
        <!-- CSS -->
        <link rel="stylesheet" href="/Student_Manager/Public/vendor/Login/bootstrap/css/bootstrap.min.css">
        <!--<link rel="stylesheet" href="/Student_Manager/Public/vendor/Login/font-awesome/css/font-awesome.min.css">-->
        <!--<link rel="stylesheet" href="/Student_Manager/Public/vendor/Login/css/form-elements.css">-->
        <link rel="stylesheet" href="/Student_Manager/Public/vendor/Login/css/style.css">
        <link href="/Student_Manager/Public/css/login.css" rel="stylesheet">

    </head>
    <body class="signin">
        <div class="signinpanel">
            <div class="row">
                <div class="col-sm-12">
                    <form id="form_login">
                        <h4 class="no-margins">登录：</h4>
                        <p class="m-t-md">登录到SPOC学习系统后台管理</p>
                        <input type="text" class="form-control uname" name="username" placeholder="职工号..." id="form_username" />
                        <input type="password" class="form-control pword m-b"  name="password" placeholder="密码" id="form_password" />
                        <a href="">忘记密码了？</a>
                        <a class="btn btn-success btn-block" id="check_login">登录</a>
                    </form>
                </div>
            </div>
            <!--<div class="signup-footer">-->
                <!--<div class="pull-left">-->
                    <!--&copy; hAdmin-->
                <!--</div>-->
            <!--</div>-->
        </div>
        <!-- 全局js -->
<!--<script src="/Student_Manager/Public/js/jquery.min.js?v=2.1.4"></script>
<script src="/Student_Manager/Public/js/bootstrap.min.js?v=3.3.6"></script>
<script type="text/javascript" src="/Student_Manager/Public/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/js/plugins/layer/layer.min.js"></script>-->

 <!--Data Tables -->
<!--<script type="text/javascript" src="/Student_Manager/Public/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/vendor/SweetAlert2/sweetalert2.min.js"></script>-->

<!--toastr-->
<!--<script type="text/javascript" src="/Student_Manager/Public/vendor/toastr/toastr.min.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/vendor/select2/select2.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/vendor/fileinput/fileinput.min.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/vendor/fileinput/locales/zh.js"></script>-->

<!--loading-->
<!--<script src="/Student_Manager/Public/vendor/loading/loading.js"></script>-->




<!-- 全局js -->
<script src="/Student_Manager/Public/js/jquery.min.js?v=2.1.4"></script>
<script src="/Student_Manager/Public/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/Student_Manager/Public/js/plugins/metisMenu/jquery.metisMenu.js"></script>
<script src="/Student_Manager/Public/js/plugins/slimscroll/jquery.slimscroll.min.js"></script>
<script src="/Student_Manager/Public/js/plugins/layer/layer.min.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/vendor/SweetAlert2/sweetalert2.min.js"></script>
<!-- 自定义js -->
<script src="/Student_Manager/Public/js/hAdmin.js?v=4.1.0"></script>
<script type=text/javascript" src=""/Student_Manager/Public/js/index.js"></script>

<!-- 第三方插件 -->
<script src="/Student_Manager/Public/js/plugins/pace/pace.min.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/vendor/fileinput/fileinput.min.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/vendor/fileinput/locales/zh.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="/Student_Manager/Public/vendor/toastr/toastr.min.js"></script>

<!--loading-->
<script src="/Student_Manager/Public/vendor/loading/loading.js"></script>

<script type="text/javascript">
    function check_index() {
        if(!document.referrer){
            window.location.href = '/Student_Manager/index.php/Test/Main/index';
        }
    }

    toastr.options = {
		"closeButton": true,
		"positionClass": "toast-top-right",
		"onclick": null,
		"showDuration": "300",
		"hideDuration": "1000",
		"timeOut": "5000",
		"extendedTimeOut": "1000",
		"showEasing": "swing",
		"hideEasing": "linear",
		"showMethod": "fadeIn",
		"hideMethod": "fadeOut"
	}

	function sil_loading() {
		$('body').loading({
			loadingWidth: 240,
			title: '请稍等!',
			name: 'test',
			discription: '正在加载...',
			direction: 'column',
			type: 'origin',
			// originBg:'#71EA71',
			originDivWidth: 40,
			originDivHeight: 40,
			originWidth: 6,
			originHeight: 6,
			smallLoading: false,
			loadingMaskBg: 'rgba(0,0,0,0.2)'
		});
	}

	function sil_reloading() {
		removeLoading('test');
	}
    // 通过text 设置select2的默认值
    function select2ByText (obj, text) {
        var select2Obj = $('#'+obj).select2();
        $(obj).select("option").each(function(data){
            if (text == data.text.strip()) {
                select2Obj.val(data.value).trigger("change");
            }
        });
    }
    function selectByText(obj,text) {
        var selectObj = $('#'+obj);
        $(selectObj).find("option").each(function(data){
            var $this = $(this);
            if (text == $this.text()) {
                selectObj.val($this.val());
            }
        });
    }
    //销毁模态框
    $(".modal").on("hidden.bs.modal", function() {
        $('.removeData').val('');
        $('.removeSelect').val("0").trigger("change");
        $('.poiu').val("0").trigger("change");
        $(".wrapper").addClass('animated');
    });


</script>
        <script src="/Student_Manager/Public/js/bootbox.js"></script>
        <script>

//            if (window.top !== window.self) {
//                window.top.location = window.location;
//            }
            if(window != top){
                top.location.href = location.href;
            }

            $('#check_login').on('click',function () {
                check_login();
            });
            $(document).ready(function() {
                var $dom = "#form_password";
                $($dom).keydown(function(event) {
                    if(event.keyCode == 13) {
                        check_login();
                        return false;

                    }
                });
            });
            function  check_login() {
                var vars = $("#form_login").serialize();
                $.ajax({
                    type : "POST",
                    url : "/Student_Manager/index.php/Home/Login/check_login",
                    async: true,
                    data : vars,
                    dataType : "json",
                    error: function (XMLHttpRequest, textStatus, errorThrown){

                    },
                    success : function(data) {
                        console.log(data);
                        if (data.status) {

                            ui_alert(data.info, function() {

                                window.location.href = '/Student_Manager/index.php/Home/Main/index';
                            });

                        } else {

                            ui_error(data.info);
                        }
                    }
                });
            }




            function ui_alert(msg, callback) {
                bootbox.dialog({
                    message :  "<h3>" + msg + "</h3>",
                    buttons : {
                        danger : {
                            label : "确定",
                            className : "btn btn-primary",
                            callback : function() {
                                if (callback != undefined) {
                                    callback();
                                }
                            }
                        }
                    }
                });
//                bootbox.alert(msg,callback);

            }
            function ui_error(msg) {
                var position= "toast-top-right";

                toastr.options = {
                    "closeButton" : true,
                    "positionClass" : position
                };
                toastr.error('', msg);
            }
        </script>
    </body>
</html>